#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <cmath>
using namespace std;
#define MAX_N 1005

int n,d;
int x[MAX_N] , y[MAX_N];
vector<vector<int> > link;

double dis(int a,int b){
    int result = 0;
    result += (x[a] - x[b])*(x[a] - x[b]);
    result += (y[a] - y[b])*(y[a] - y[b]);
    return sqrt(result);
}

int fa[MAX_N];
int added[MAX_N];

int Find(int x){
    if (fa[x]==x) return fa[x];
    return Find(fa[x]);
}

void Union(int x,int y){
    x = Find(x);
    y = Find(y);
    fa[x] = y;
}

int main(){
   // freopen("2236.txt","r",stdin);

    scanf("%d%d",&n,&d);
    for (int i  = 1;  i <= n ; i++){
        scanf("%d%d",&x[i],&y[i]);
    }

    link.resize(n+2);
    for (int i = 1 ; i <= n ; i++)
    {
        for (int j = 1 ; j<=n ; j++){
            if (i==j) continue;
            if (dis(i,j) <= d) link[i].push_back(j);
        }
    }

    char op[3];
    int u,v;

    for (int i = 1; i <= n ; i++) fa[i] = i;
    memset(added,0,sizeof(added));

    while (scanf("%s",op)!=EOF){
        if(op[0]=='O'){
            scanf("%d",&u);
            for (int i = 0; i < link[u].size() ; i++) {
                if (added[link[u][i]]) Union(link[u][i], u);
            }
            added[u] = 1;
        }else{
            scanf("%d%d",&u,&v);
            if (Find(u)==Find(v)) printf("SUCCESS\n");
            else printf("FAIL\n");
        }
    }
    return 0;
}
